Optimal. Leaf size=103 \[ \frac {d (2 b c-a d) \tanh ^{-1}(\sin (e+f x))}{b^2 f}+\frac {2 (b c-a d)^2 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} f}+\frac {d^2 \tan (e+f x)}{b f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.226, Rules used = {4073, 3031,
2738, 214, 3855, 3852, 8} \begin {gather*} \frac {d (2 b c-a d) \tanh ^{-1}(\sin (e+f x))}{b^2 f}+\frac {2 (b c-a d)^2 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{b^2 f \sqrt {a-b} \sqrt {a+b}}+\frac {d^2 \tan (e+f x)}{b f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 214
Rule 2738
Rule 3031
Rule 3852
Rule 3855
Rule 4073
Rubi steps
\begin {align*} \int \frac {\sec (e+f x) (c+d \sec (e+f x))^2}{a+b \sec (e+f x)} \, dx &=\int \frac {(d+c \cos (e+f x))^2 \sec ^2(e+f x)}{b+a \cos (e+f x)} \, dx\\ &=\int \left (\frac {(b c-a d)^2}{b^2 (b+a \cos (e+f x))}+\frac {d (2 b c-a d) \sec (e+f x)}{b^2}+\frac {d^2 \sec ^2(e+f x)}{b}\right ) \, dx\\ &=\frac {d^2 \int \sec ^2(e+f x) \, dx}{b}+\frac {(b c-a d)^2 \int \frac {1}{b+a \cos (e+f x)} \, dx}{b^2}+\frac {(d (2 b c-a d)) \int \sec (e+f x) \, dx}{b^2}\\ &=\frac {d (2 b c-a d) \tanh ^{-1}(\sin (e+f x))}{b^2 f}-\frac {d^2 \text {Subst}(\int 1 \, dx,x,-\tan (e+f x))}{b f}+\frac {\left (2 (b c-a d)^2\right ) \text {Subst}\left (\int \frac {1}{a+b+(-a+b) x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{b^2 f}\\ &=\frac {d (2 b c-a d) \tanh ^{-1}(\sin (e+f x))}{b^2 f}+\frac {2 (b c-a d)^2 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} f}+\frac {d^2 \tan (e+f x)}{b f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.83, size = 135, normalized size = 1.31 \begin {gather*} \frac {-\frac {2 (b c-a d)^2 \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+d \left (-\left ((2 b c-a d) \left (\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )\right )+b d \tan (e+f x)\right )}{b^2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.37, size = 165, normalized size = 1.60
method | result | size |
derivativedivides | \(\frac {-\frac {d^{2}}{b \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}+\frac {d \left (a d -2 b c \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{b^{2}}-\frac {d^{2}}{b \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}-\frac {d \left (a d -2 b c \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{b^{2}}-\frac {2 \left (-a^{2} d^{2}+2 a b d c -b^{2} c^{2}\right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{2} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{f}\) | \(165\) |
default | \(\frac {-\frac {d^{2}}{b \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}+\frac {d \left (a d -2 b c \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{b^{2}}-\frac {d^{2}}{b \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}-\frac {d \left (a d -2 b c \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{b^{2}}-\frac {2 \left (-a^{2} d^{2}+2 a b d c -b^{2} c^{2}\right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{2} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{f}\) | \(165\) |
risch | \(\frac {2 i d^{2}}{f b \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) a}{b^{2} f}-\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) c}{b f}-\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) a}{b^{2} f}+\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) c}{b f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) a^{2} d^{2}}{\sqrt {a^{2}-b^{2}}\, f \,b^{2}}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) a d c}{\sqrt {a^{2}-b^{2}}\, f b}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) c^{2}}{\sqrt {a^{2}-b^{2}}\, f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i a^{2}+i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) a^{2} d^{2}}{\sqrt {a^{2}-b^{2}}\, f \,b^{2}}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i a^{2}+i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) a d c}{\sqrt {a^{2}-b^{2}}\, f b}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i a^{2}+i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right ) c^{2}}{\sqrt {a^{2}-b^{2}}\, f}\) | \(564\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 240 vs.
\(2 (97) = 194\).
time = 8.62, size = 540, normalized size = 5.24 \begin {gather*} \left [\frac {2 \, {\left (a^{2} b - b^{3}\right )} d^{2} \sin \left (f x + e\right ) + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {a^{2} - b^{2}} \cos \left (f x + e\right ) \log \left (\frac {2 \, a b \cos \left (f x + e\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (f x + e\right ) + a\right )} \sin \left (f x + e\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (f x + e\right )^{2} + 2 \, a b \cos \left (f x + e\right ) + b^{2}}\right ) + {\left (2 \, {\left (a^{2} b - b^{3}\right )} c d - {\left (a^{3} - a b^{2}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (2 \, {\left (a^{2} b - b^{3}\right )} c d - {\left (a^{3} - a b^{2}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )} f \cos \left (f x + e\right )}, \frac {2 \, {\left (a^{2} b - b^{3}\right )} d^{2} \sin \left (f x + e\right ) + 2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (f x + e\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (f x + e\right )}\right ) \cos \left (f x + e\right ) + {\left (2 \, {\left (a^{2} b - b^{3}\right )} c d - {\left (a^{3} - a b^{2}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (2 \, {\left (a^{2} b - b^{3}\right )} c d - {\left (a^{3} - a b^{2}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )} f \cos \left (f x + e\right )}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (c + d \sec {\left (e + f x \right )}\right )^{2} \sec {\left (e + f x \right )}}{a + b \sec {\left (e + f x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 195 vs.
\(2 (94) = 188\).
time = 0.51, size = 195, normalized size = 1.89 \begin {gather*} -\frac {\frac {2 \, d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )} b} - \frac {{\left (2 \, b c d - a d^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{b^{2}} + \frac {{\left (2 \, b c d - a d^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{b^{2}} + \frac {2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} b^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.32, size = 2500, normalized size = 24.27 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________